@extends('admin.base')
@section('title','云仓库列表')
@section('header','云仓库列表')
@section('content')

    <fieldset class="layui-elem-field">
        <div class="layui-field-box">
            <a class="layui-btn-sm" href="{{url('admin/home')}}">首页</a>&raquo;
            <span class="layui-btn-sm">云仓库列表</span>
        </div>
    </fieldset>

    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <form method="get">
                    <div class="layui-card-header ">
                        <div class="layui-form " style="display: flex;">
                            <p class="">关键字：</p>
                            <!--搜索框-->
                            <div class="layui-inline sousuo">
                                <div class="layui-input-inline">
                                    <input type="text" name="keywords" class="layui-input" id="" placeholder="请输入用户ID"
                                           value="{{$request->keywords}}">
                                </div>
                            </div>
                            <button type="submit" class="layui-btn ok" style="margin-top:4px">确定</button>
                        </div>
                    </div>
                </form>
                <div class="layui-card-body">

                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>用户ID</th>
                            <th>用户账户</th>
                            <th>开启时间</th>
                            <th>结束时间</th>
                            <th>状态</th>
                            {{--<th>类型</th>--}}
                            <th>到期状态</th>
                            <th>创建时间</th>
                            {{--<th>操作</th>--}}
                        </tr>
                        </thead>
                        <tbody>
                        @forelse($list as $vo)
                            <tr>
                                <td>{{$vo->uid}}</td>
                                <td>{{$vo->username}}</td>
                                <td>{{$vo->start}}</td>
                                <td>{{$vo->end}}</td>
                                <td>@if($vo->state == 1)开启
                                    @elseif($vo->state == 2)冻结
                                    @endif
                                </td>
                                {{--<td>{{$vo->type}}</td>--}}
                                <td>
                                    @if($vo->is_end == 1)未到期
                                    @elseif($vo->is_end == 2)已到期
                                    @endif
                                </td>
                                <td>{{$vo->created_at}}</td>
                                {{--<td>--}}
                                    {{--<a href="/admin/notice/edit/{{$vo->id}}"--}}
                                       {{--class="layui-btn layui-btn-sm">修改</a>--}}
                                    {{--<a href="#" onclick="del_cy('{{$vo->id}}','确认删除吗?')"--}}
                                       {{--class="layui-btn layui-btn-sm layui-btn-danger">删除</a>--}}
                                {{--</td>--}}
                            </tr>
                        @empty
                            <tr>
                                <td colspan="11" style="text-align:center">暂无内容</td>
                            </tr>
                        @endforelse
                        </tbody>
                    </table>
                    {{$list->appends(Request::all())->links()}}
                </div>
            </div>
        </div>
    </div>
@endsection
@section('js')
    <script>
        layui.use('element', function () {
            var element = layui.element;
        });

        function change_state(id, value, msg) {
            event.preventDefault();
            layer.confirm(msg, {
                btn: ['确认', '取消'] //按钮
            }, function () {
                window.location.href = '/admin/store/change_state/' + id + '?value=' + value;

            })
        }

        function del_cy(id, msg) {
            event.preventDefault();
            layer.confirm(msg, {
                btn: ['确认', '取消'] //按钮
            }, function () {
                window.location.href = '/admin/notice/del/' + id ;

            })
        }

        function sorts(id, num) {
            layer.prompt({
                formType: 3,
                value: num,
                title: '修改排序'
            }, function (value, index, elem) {
                var index = layer.load();
                $.post("/admin/notice/update_sort", {
                    id: id,
                    sort: value,
                    _token: "{{csrf_token()}}"
                }, function (data) {
                    layer.close(index);
                    layer.msg(data.msg);
                    if (data.code == 1) {
                        location.reload();
                    }

                })
            });
        }

        //搜索
        form.on('submit(selectsub)', function(data){
            let keywords = $('#sub_keywords').val();//关键字
            // let level = $("#level option:selected").val();//级别
            // layer.msg(keywords+"|"+month+"|"+level)
            location.href = "{{url('admin/store/index')}}"+"?keywords="+keywords;
            return false;
        });
    </script>
@endsection
